//
//  SectionHeaderView.m
//  Study1
//
//  Created by ChenJie on 2/10/20.
//  Copyright © 2020 OrgName. All rights reserved.
//

#import "SectionHeaderView.h"

@interface SectionHeaderView ()

@property (nonatomic, copy) NSString *labelText;
@property (nonatomic, strong) UILabel *label;

@end

@implementation SectionHeaderView

#pragma mark - Lifecycle methods

//+ (void)load {
/// Do not keep an empty +load method
//}

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor lightGrayColor];
        [self addSubview:self.label];
    }
    return self;
}

- (void)willMoveToSuperview:(UIView *)newSuperview {
    [super willMoveToSuperview:newSuperview];
}

- (void)didMoveToSuperview {
    [super didMoveToSuperview];
}

- (void)willMoveToWindow:(UIWindow *)newWindow {
    [super willMoveToWindow:newWindow];
}

- (void)didMoveToWindow {
    [super didMoveToWindow];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    //
    self.label.frame = self.bounds;
}

#pragma mark - Public methods



#pragma mark - Private methods



#pragma mark - Event response methods



#pragma mark - Delegate methods



#pragma mark - Setter

- (void)setSectionIndex:(NSInteger)sectionIndex {
    _sectionIndex = sectionIndex;
    
    //
    self.labelText = [NSString stringWithFormat:@"header 最近很多人已经开工了，但是由于众所周知的方法，多个城市都是要严查某些省市的人员的，如何证明自己之前去或者没去过那些敏感地区？这是个难题，现在可以借助运营商的漫游查询来证明个人轨迹了of section: %ld", (long)sectionIndex];
}

- (void)setLabelText:(NSString *)labelText {
    _labelText = labelText;
    
    //
    self.label.text = labelText;
}

#pragma mark - Getter

- (UILabel *)label {
    if (!_label) {
        UILabel *label = [[UILabel alloc] initWithFrame:CGRectZero];
        label.textAlignment = NSTextAlignmentLeft;
//        label.font = [UIFont systemFontOfSize:50];
        label.numberOfLines = 0;
        _label = label;
    }
    return _label;
}

#pragma mark - Memory management methods

- (void)dealloc {
}

@end
